arm/p2m: Rework p2m_init()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Oct 2022 09:21:11 +0000 (09:21 +0000)
committerJulien Grall <jgrall@amazon.com>
Tue, 25 Oct 2022 19:52:43 +0000 (20:52 +0100)
commit86cb37447548420e41ff953a7372972f6154d6d1
treead58eba392c041fb685717171bf0c15fab1115d1
parent1bce7fb1f702da4f7a749c6f1457ecb20bf74fca
arm/p2m: Rework p2m_init()

p2m_init() is mostly trivial initialisation, but has two fallible operations
which are on either side of the backpointer trigger for teardown to take
actions.

p2m_free_vmid() is idempotent with a failed p2m_alloc_vmid(), so rearrange
p2m_init() to perform all trivial setup, then set the backpointer, then
perform all fallible setup.

This will simplify a future bugfix which needs to add a third fallible
operation.

No practical change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
(cherry picked from commit: 3783e583319fa1ce75e414d851f0fde191a14753)
xen/arch/arm/p2m.c